package com.haidong;

import com.haidong.config.SpringConfig;
import com.haidong.domain.Account;
import com.haidong.service.AccountService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class App2 {
    public static void main(String[] args) {
        // 采用纯注解开发之后,只需要把mybatis需要的bean参数都给齐就行
        // sqlSession工厂已经归IOC管理,直接调用service里面的方法即可,至于获取mapper都交给MapperScannerConfigurer代理对象
        ApplicationContext ctx = new AnnotationConfigApplicationContext(SpringConfig.class);
        AccountService accountService = ctx.getBean(AccountService.class);

        Account account = accountService.findById(1);
        System.out.println(account);
    }
}
